package com.you.atlas.web.place.module.screen;

import org.springframework.beans.factory.annotation.Autowired;

import com.alibaba.citrus.turbine.Navigator;
import com.alibaba.citrus.turbine.dataresolver.Param;
import com.you.atlas.biz.place.service.PhotoService;
import com.you.common.webx.AuthContext;

public class PhotoDelete {

    @Autowired
    private PhotoService photoService;

    public void execute(@Param("from") String from,@Param("albumId") Long albumId, @Param("placeId") String placeId, Navigator navigator) {

        Long memberId = AuthContext.getContext().getMemberId();
        photoService.removePhoto(albumId, memberId);
        if("member".equals(from)){
            navigator.redirectTo("memberModule").withTarget("photoList.vm").withParameter("id", memberId.toString());
        }else{
            
            navigator.redirectTo("placeModule").withTarget("photoList.vm").withParameter("id", placeId);
        }
    }
}
